/**
 * 房源相关API
 */

import { http, Method } from "@/utils/request.js";

import api from "@/config/api.js";

/**
 * 获取收货地址列表
 * @returns {AxiosPromise}
 */
export function findHouseRoomList(params) {
  return http.request({
    url: "/api/houseApi/findHouseRoomList",
    method: Method.GET,
    //needToken: true,
    params,
  });
}


export function findAgentHouseRoomList(params) {
  return http.request({
    url: "/api/houseApi/findAgentHouseRoomList",
    method: Method.GET,
    //needToken: true,
    params,
  });
}

/**
 * 获取推荐房源--findHouseListRecommend
 * @param params
 * @returns {*}
 */
export function findHouseListRecommend(params) {
  return http.request({
    url: "/api/houseApi/findHouseListRecommend",
    method: Method.GET,
  //  needToken: true,
    params,
  });
}

//统计房源--statistics
export function statistics() {
  return http.request({
    url: "/api/houseApi/statistics",
   // method: Method.GET,
    needToken: true,
  });
}

//房源评价selectHouseEvals
export function selectHouseEvals(params) {
  return http.request({
    url: "/api/houseApi/selectHouseEvals",
    method: Method.GET,
    //needToken: true,
    params,
  });
}


//selectHouseHeart--收藏
export function selectHouseHeart(params) {
  return http.request({
    url: "/api/houseApi/selectHouseHeart",
    method: Method.GET,
    needToken: true,
    params,
  });
}

//保存收藏  saveHeart
export function saveHeart(params) {
  return http.request({
    url: "/api/houseApi/saveHeart",
    method: Method.POST,
    needToken: true,
    params,
  });
}



export function saveHouseEvals(params) {
  return http.request({
    url: "/api/houseApi/saveHouseEvals",
    method: Method.GET,
    needToken: true,
    params,
  });
}

export function findHouseById(params) {
  return http.request({
    url: "/api/houseApi/findHouseById",
    method: Method.GET,
    needToken: true,
    params,
  });
}
export function findVillageList(params) {
  return http.request({
    url: "/api/houseApi/findVillageList",
    method: Method.GET,
    needToken: true,
    params,
  });
}


export function saveHouse(params) {
  return http.request({
    url: "/api/houseApi/saveHouse",
    method: Method.POST,
    needToken: true,
    data: params,
  });
}

//updateHouse
export function updateHouse(params) {
  return http.request({
    url: "/api/houseApi/updateHouse",
    method: Method.POST,
    needToken: true,
    data: params,
  });
}

/**
 * 下架房源
 * @PutMapping(value = "/disable/{id}")
 * @param params
 * @returns {*}
 */
export function disableHouse(id) {
  return http.request({
    url: "/api/houseApi/disable/"+id,
    method: Method.PUT,
    needToken: true
  });
}

/**
 * 上架房源
 * @PutMapping(value = "/enable/{id}")
 * @param params
 * @returns {*}
 */
export function enableHouse(id) {
  return http.request({
    url: "/api/houseApi/enable/"+id,
    method: Method.PUT,
    needToken: true
  });
}

/**
 * 拒绝房源申请
 * @PutMapping(value = "/refused/{id}/{content}")
 * @param params
 * @returns {*}
 */
export function refusedHouse(id,content) {
  return http.request({
    url: "/api/houseApi/refused?id="+id+"&content="+content,
    method: Method.PUT,
    needToken: true
  });
}




//评估
export function evaluateHouse(params) {
  return http.request({
    url: "/api/houseApi/evaluateHouse",
    method: Method.POST,
    needToken: true,
    data: params,
  });
}

export function getRealCity() {
  return http.request({
    url: "/api/houseApi/profile/getRealCity",
    method: Method.GET,
    needToken: true
  });
}


export function getRealCityByIP(ip) {
  return http.request({
    url: "/api/houseApi/profile/getRealCityByIP?ip"+ip,
    method: Method.GET,
    needToken: true
  });
}


/**
 * 获取房源信息曝光   @GetMapping("/exposure/{id}")
 */
export function exposureHouse(id) {
  return http.request({
    url: "/api/houseApi/exposure/"+id,
    method: Method.GET,
    needToken: true
  });
}

/**
 * 获取热门房源列表
 * /exposure/hot
 */
export function exposureHot(params) {
  return http.request({
    url: "/api/houseApi/exposure/hot",
    method: Method.GET,
    needToken: true,
    params,
  });
}




